package com.baizhi.dao;

import com.baizhi.domain.Article;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

// 自定义接口需要继承JpaRepository<实体类类型, 实体类主键类型>, JpaSpecificationExecutor<实体类类型>
public interface Article4Dao extends JpaRepository<Article, Integer>, JpaSpecificationExecutor<Article> {

    // 本地SQL查询
    @Query(value = "select * from article a where a.title = ?1 and a.author = ?2", nativeQuery = true)
    List<Article> findByCondition1(String title, String author);
}
